var path = require("path");
var fs = require("fs");
 
fs.readdir('./dist', function(err, files){
    var dirs = [];
    (function iterator(i){
      if(i == files.length) {
        let cmd = `scp {${dirs.join(',')}} root@139.155.74.67:/usr/local/project/hjx-admin/`
        console.log(cmd);
        return ;
      }
      fs.stat(path.join('./dist', files[i]), function(err, data){     
        if(data.isFile()){               
            dirs.push(files[i]);
        }
        iterator(i+1);
       });   
    })(0);
});

